package com.jinmdz.app.api.api.controller;

import com.jinmdz.app.api.api.model.coffin.CoffinDeadData;
import com.jinmdz.app.api.api.model.common.BusinessCodeData;
import com.jinmdz.app.api.api.service.CoffinService;
import com.jinmdz.app.api.base.BaseController;
import com.jinmdz.fmis.core.base.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 遗体装棺接口
 *
 * @author JiYanJiang
 * @date 2020-08-24 14:33
 */
@Api(description = "遗体装棺相关接口")
@RestController()
@RequestMapping("/api/coffin")
public class CoffinController extends BaseController {

    @Resource
    private CoffinService coffinService;

    /**
     * @param data
     * @return com.jinmdz.fmis.core.base.BaseResult<com.jinmdz.app.api.api.model.coffin.CoffinDeadData>
     * @author JiYanJiang
     * @date 2020-08-25 13:34
     */
    @ApiOperation(value = "加载遗体装棺页面相关信息", notes = "根据businessCode加载预定纸棺信息和逝者相关信息")
    @PostMapping("/load-coffin-dead-with-business-code")
    public BaseResult<CoffinDeadData> loadCoffinWithBusinessCode(@RequestBody BusinessCodeData data) {
        return resultHandler(data, userItem -> coffinService.loadCoffinDeadWithBusinessCode(data));
    }


}
